package com.wang.springframework.context.support;


import com.wang.springframework.beans.BeansException;

/**
 * @author wangjianhua
 * @Description
 * @date 2021/8/25/025 16:42
 **/
public class ClassPathXmlApplicationContext extends AbstractXmlApplicationContext {

    private String[] configLocations;

    public ClassPathXmlApplicationContext()  {
    }

    /**
     * 从xml 中加载 BeanDefinition 并刷新上下文
     * @param configLocations 配置文件
     * @throws BeansException 异常
     */
    public ClassPathXmlApplicationContext(String configLocations) throws BeansException {
        this(new String[]{configLocations});
    }



    /**
     * 从xml 中加载 BeanDefinition 并刷新上下文
     * @param configLocations 配置文件
     * @throws BeansException 异常
     */
    public ClassPathXmlApplicationContext(String[] configLocations) throws BeansException {
        this.configLocations = configLocations;
        refresh();
    }

    @Override
    protected String[] getConfigLocations() {
        return configLocations;
    }
}
